{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.字符串中的字符是否唯一？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 初始化集合\n",
    "hashset = {1, 2, 3, 4}\n",
    "\n",
    "# 是否为空，输出：False\n",
    "print(len(hashset) == 0)\n",
    "\n",
    "# 大小，输出：4\n",
    "print(len(hashset))\n",
    "\n",
    "# 查找元素\n",
    "if 3 in hashset:\n",
    "    print(\"Element 3 found.\")\n",
    "else:\n",
    "    print(\"Element 3 not found.\")\n",
    "# 输出：Element 3 found.\n",
    "\n",
    "# 插入新元素\n",
    "hashset.add(5)\n",
    "\n",
    "# 删除元素 2\n",
    "hashset.discard(2)  # discard 不存在的元素不会报错\n",
    "\n",
    "# 检查删除后\n",
    "if 2 in hashset:\n",
    "    print(\"Element 2 found.\")\n",
    "else:\n",
    "    print(\"Element 2 not found.\")\n",
    "# 输出：Element 2 not found.\n",
    "\n",
    "# 遍历集合，输出：\n",
    "# 1\n",
    "# 3\n",
    "# 4\n",
    "# 5\n",
    "for element in hashset:\n",
    "    print(element)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'dict' object has no attribute 'append'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[1], line 12\u001b[0m\n\u001b[1;32m     10\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m input_data:\n\u001b[1;32m     11\u001b[0m   \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m my_dict:\n\u001b[0;32m---> 12\u001b[0m     \u001b[43mmy_dict\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mappend\u001b[49m(item)\n\u001b[1;32m     13\u001b[0m   \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m     14\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNO\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
      "\u001b[0;31mAttributeError\u001b[0m: 'dict' object has no attribute 'append'"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import sys\n",
    "\n",
    "# 请在此输入您的代码\n",
    "original_data = input()\n",
    "input_data = original_data.lower()\n",
    "if len(input_data) == 0:\n",
    "  print(\"YES\")\n",
    "my_dict = dict()\n",
    "for item in input_data:\n",
    "  if item not in my_dict:\n",
    "    my_dict.append(item)\n",
    "  else:\n",
    "    print(\"NO\")\n",
    "print(\"YES\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "science39",
   "language": "python",
   "name": "science39"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
